<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>css浮动</title>

    <style>
        .father {
            background-color: blue;    
            /* height: 150px; */
            border: 30px solid brown ;
            /* 清除浮动 */
            overflow: hidden;
        }
        /* 清除浮动 伪元素法 */
        .father::after {
            content: "";
            display: table;
            clear:both;
            
        }

        .left-son {
            background-color: yellow;
            width: 100px;
            height: 100px;
            float: left;
        }

        .right-son {
            background-color: yellow;
            width: 100px;
            height: 100px;
            float: right;
        }

    </style>
</head>
<body>
    <div class="father">
        <div class="left-son">左浮动</div>
        <div class="right-son">右浮动</div>
    </div>

    <p>这是一段文本 </p>

</body>
</html>